#! /bin/bash
## -10

## Script colours Vars.
t='\e[0;39m'	#default terminal colour
r='\e[1;31m'	#red
v='\e[1;32m'	#green
y='\e[1;36m'	#cyan
j='\e[1;33m'	#yellow

## Main Menu Vars
A=" From a local archive."
B=" From a local package."
C=" From NVIDIA server."
D=" Build an archive only."
E=" Uninstall actual driver"
F=" Stop X server."
G=" Restart X server."
H=" Check aviable updates."
I=" Quit." 
## Classic questions
qst001="(y/n)"
qst002="Will you ?"
qst003="Type $j[C]$v to confirm.\n\t Else, type$j [Q]$v to leave."


## Classic answer
ans001="y"
ans002="Your Choice :"

### dependencies control
msg101="Distro is not define. Install script dependencies manually " # 97
msg102="$y INSTALL RUNNING..." # 105
msg103="$y INSTALL DONE..." # 107
### Primary control of X and network connection.
msg104="I'm actually in Graphic Mode.\n  I need to stop it.\n  Once in terminal session, restart this script in ROOT" # 130
msg105="Note:$y If you only wish to check last driver version aviable"
msg114="  or config the Xorg config,"
msg115="  you don't need to stop the X server." # 131
msg106="WARNING!$v You are not connected to the network.\n  If I have to make an update from the server,\n  I need a valid connection." # 133
msg107="Shall I stop the X session for you?" # 135
msg108="BEWARE ABOUT YOUR CURRENT WORK, CLOSE ALL APPLICATIONS\r BEFORE THIS COMMAND VALIDATION" # 138
#msg109="Type $j[C]$v to confirm.\n\t Else, type$j [Q]$v to leave." # 139
msg110="INIT" # 145
msg111="We are "
msg112="IP is "
msg113="interface"
msg119="router"
### Directories and files listing.
#msg111="Your Choice :\n ==>" # 147 ans002
# Internet connection control function.
msg116="connected"
msg117="not connected."
msg118="over"
### check aviable updates
msg201="Aviable drivers for " # 263
msg202="Present version is :" # 264
msg203="Last official is :" # 265
msg204="Last BETA is :" # 266
### ARCHIVED DRIVERS INSTALL FUNCTION.
msg220="Select an archive in the list:" # 270
msg221="You select" # 277
msg222="UNARCHIVING RUNNING!" # 278
msg223="Deleting originals files and links..." # 280
msg224="Links creation..." # 283
msg225="Creation ends nicely" # 288
msg226="Creation ends badly." # 290
msg227="Back to main menu." # 291
msg228="I need to restart X server for changes take effect." # 294
#msg229="Will you?\n$j (y/n)" # 294 *
msg229="Restarting X server." # 298
msg230="was updated the"
msg231="at"
### ARCHIVED DRIVERS INSTALL FUNCTION.
#f1
msg301="INSTALL STARTS, PLEASE WAIT!" # 311
msg302="Congratulation! Your driver is installed." # 313
msg303="Driver copy backup" # 321
msg304="I could proceed to archiving." # 321
msg305="successful" # 324
msg306="unsuccessful." # 324
msg307="The Script needs this backup for further archiving\n and other operations. Do it manually\n and ask the author to fix this." # 325
msg308="$r\BIG WARNING$v DON'T DO ANY BACKUP\n without this file in NVIDIA path\n it could damage your installes distro seriously!" # 327
msg309="Hit a key to continu." # 328
msg310="Ouch!$v You don't have a valid NVIDIA package in this directory \n I suggest you to go to NVIDIA site," # 334
msg311="here :" # 335
msg312="and, please baby come back to me!." # 337
msg313="Back to main menu or restart X server ?" # 338
msg314="Main menu." # 339
msg315="Restart X." # 339
# f2
msg320="Here is the list of present driver(s) in the NVIDIA path:" # 351
msg321="You can select one of them or select an other from user directory:" # 353
msg322="Present version" # 354
msg323="User dir" # 355
msg324="Here is the listing of" # 360
msg325="Let go on in" # 379
msg326="Use [TAB] to follow the yellow brick road to your driver :" # 381
### UPDATE FUNCTION, FROM INTERNET.
# download functions 
msg401="UPDATE, PLEASE WAIT!" # 396
msg402="DOWNLOAD DONE." # 398
msg403="PACKAGE EXTRACTION" # 399
msg404="Houston! We got a problem over there, no temp dir!\n Back to main" # 410
# script
msg411=" I'm not " # 421
msg412="Type $j[C]$v to choose one of those versions." # 429
msg413="Please select your desired version:" # 432
msg414="Official driver installation begins... " # 439
msg415="BETA driver installation begins..." # 447
msg416="$jOoops!$v No nvidia-installer in my dir.\n I have to work with local package" # 463
msg417=" Connect me and restart the script."
msg418=" I can't perform this action."
msg419="Other"
msg420="Pick a driver in the list"
msg421="Your choice is :"
msg422="or an older from a list in next menu."
msg423="Else, type $j[M]$v to go back to main menu."
### ARCHIVING.
# sub function method
msg501="I can backup the driver now." # 477
msg502="Controling..." # 481
msg503="is present and correctly unzip." # 485
msg504="The$r working temp directory$v is empty.\n Something bad in the script ?" # 487
msg505="I need to restart X server" # 491
msg506="Select $j$G$v inthe main menu." # 492
msg507="I could build the archive later\n from $j$D$v in main menu." # 498
msg508="I need to restart DM service now" # 499
msg509="Select $j$G$v in main menu." # 500
# archive function
msg511="Proceed to creation for archive" # 512
msg512="Working temporary directory doesn't exist." # 514
msg513="Check your package or contact the author." # 515msg001=
msg514="Your archive is created.\n  It known under the name" # 546msg001=
msg515="$y\Houston ! We got a problem over there ! \n$v Is there a little bug in archive creation?" # 549
msg516="Check the script or contact the author!" # 550
# actual driver version before pkg run extraction
msg521="Installed driver version is." # 559
msg522="The package version is" # 560
msg523="The directory is already exist,$y\n I don't proceed to extraction." # 562
msg524="The directory doesn't exist,$y\n I proceed to extraction." # 565
msg525="not here...check your package and/or the script" # 574
msg526="The directory" # 581 a
msg527="doesn't exist." # 581 b
msg528="Back to menu." # 582
### UNINSTALL fUnction
msg531="UNINSTALL RUNING!" # 604
msg532="Done, back to menu." # 606
### MAIN MENU
msg601="Installation method:" # 611
#msg602="Your Choice:" # 612 **
msg602="Install from a local archive." # 616
msg603="Update from a local NVIDIA package. " # 619
msg604="Retriving informations from NVIDIA server." # 622
msg605="Backup of an actual driver." # 625
msg606="remove the present driver" # 628
msg607="Stopping the Graphic Interface" # 631
msg608="Restarting the Graphic Interface" # 635
msg609="Retrieving list ..." # 639
### FIRST START
msg701="         --- WELCOME TO THE NVIDIA \"BIDULEUR\" ---        " # 650
msg702="       ---    the propriatary driver stuffer    ---        " # 651
msg703=" This script intend to help you to install, update, backup," # 652
msg704=" your Nvidia drivers. It will help you to turn back to previous or" # 653
msg705=" prefered version in case of bug or whatever.\n" # 654
msg706="System :" # 658 a
msg707="Processor type :" # 658 b
msg708="Board :" # 658 c
msg709="Working directories control." # 659
msg710="Directories are present." # 669
msg711="The$j NVIDIA MAKER$y directory doesn't exist" # 673
msg712="Choose the directory you want, I prefer /usr/local/src/" # 674
msg713="but it is really arbitrary:" # 675
### SCRIPT INTRO
msg801=" Usages :"
msg802="\t -t (terminal) \t exec in terminal mode." # 699
msg803="\t -x (xterm-ui) \t exec in a pretty xterm interface."
msg804="\t -h (help) \t this help." # 700
